﻿
namespace NetROS.Tiers.Windows.Forms
{
	/// <summary>
	/// abstract Artikl typed datagridview
	/// </summary>
	[System.ComponentModel.DesignerCategoryAttribute("code")]
	public abstract class ArtiklDataGridViewBase : System.Windows.Forms.UserControl
	{	
		/// <summary> 
		/// Thrown when the current Entity changed.
		/// </summary>
		public event System.EventHandler<ArtiklDataGridViewEventArgs> CurrentEntityChanged;
		
		#region Fields
				
		/// <summary> 
		/// the current entity.
		/// </summary>
		private Entities.Artikl _currentArtikl = null;
		//private Dictionary<string, string> _columnsHeaders = new Dictionary<string, string>();
		
		/// <summary> 
		/// the datagridview instance
		/// </summary>
		protected System.Windows.Forms.DataGridView uxArtiklDataGridView;
		
		/// <summary> 
		/// the errorprovider
		/// </summary>
		protected System.Windows.Forms.ErrorProvider uxArtiklErrorProvider;
		
		/// <summary> 
		/// the bindingsource
		/// </summary>
		protected System.Windows.Forms.BindingSource uxArtiklBindingSource;
		
		/// <summary> 
		/// the DGV column associated with the ID property
		/// </summary>
		protected System.Windows.Forms.DataGridViewComboBoxColumn uxIDDataGridViewColumn;
		
		/// <summary> 
		/// the DGV column associated with the Naziv property
		/// </summary>
		protected System.Windows.Forms.DataGridViewTextBoxColumn uxNazivDataGridViewColumn;
		
		/// <summary> 
		/// the DGV column associated with the BarCode property
		/// </summary>
		protected System.Windows.Forms.DataGridViewTextBoxColumn uxBarCodeDataGridViewColumn;
		
		/// <summary> 
		/// the DGV column associated with the Kataloskibroj property
		/// </summary>
		protected System.Windows.Forms.DataGridViewTextBoxColumn uxKataloskibrojDataGridViewColumn;
		
		/// <summary> 
		/// the DGV column associated with the OptimalnaKol property
		/// </summary>
		protected System.Windows.Forms.DataGridViewTextBoxColumn uxOptimalnaKolDataGridViewColumn;
		
		/// <summary> 
		/// the DGV column associated with the Slika property
		/// </summary>
		protected System.Windows.Forms.DataGridViewTextBoxColumn uxSlikaDataGridViewColumn;
		/// <summary> 
		/// the DGV column associated with the IDProizvodac property
		/// </summary>
		protected System.Windows.Forms.DataGridViewComboBoxColumn uxIDProizvodacDataGridViewColumn;
		/// <summary> 
		/// the DGV column associated with the IDJedinicnaMjera property
		/// </summary>
		protected System.Windows.Forms.DataGridViewComboBoxColumn uxIDJedinicnaMjeraDataGridViewColumn;
		/// <summary> 
		/// the DGV column associated with the IDArtiklKategorija property
		/// </summary>
		protected System.Windows.Forms.DataGridViewComboBoxColumn uxIDArtiklKategorijaDataGridViewColumn;
		/// <summary> 
		/// the DGV column associated with the IDPorez property
		/// </summary>
		protected System.Windows.Forms.DataGridViewComboBoxColumn uxIDPorezDataGridViewColumn;
		
		/// <summary> 
		/// the DGV column associated with the Usluga property
		/// </summary>
		protected System.Windows.Forms.DataGridViewTextBoxColumn uxUslugaDataGridViewColumn;
		
		/// <summary> 
		/// the DGV column associated with the CijenaUsluge property
		/// </summary>
		protected System.Windows.Forms.DataGridViewTextBoxColumn uxCijenaUslugeDataGridViewColumn;
		/// <summary> 
		/// the DGV column associated with the IDArtiklStatus property
		/// </summary>
		protected System.Windows.Forms.DataGridViewComboBoxColumn uxIDArtiklStatusDataGridViewColumn;
		
		#endregion
					
		#region Combo list
		
				
		private Entities.TList<Entities.Artikl> _IDList;
		
		/// <summary> 
		/// The list of selectable Artikl
		/// </summary>
		[System.ComponentModel.Category("DropDownList BindingSources")]
		public Entities.TList<Entities.Artikl> IDList
		{
			get {return this._IDList;}
			set 
			{
				this._IDList = value;
				this.uxIDDataGridViewColumn.DataSource = null;
				this.uxIDDataGridViewColumn.DataSource = this._IDList;
			}
		}
		
		private bool _allowNewItemInIDList;
		
		/// <summary> 
		/// Indicates if user can add an item in the list of Artikl
		/// </summary>
		[System.ComponentModel.Category(".netTiers"), System.ComponentModel.Description("Indicates if end user can add a new item in the combobox. an event will be thrown then.")]
		public bool AllowNewItemInIDList
		{
			get { return _allowNewItemInIDList;}
			set
			{
				this._allowNewItemInIDList = value;
				this.uxIDDataGridViewColumn.DisplayStyle = value ? System.Windows.Forms.DataGridViewComboBoxDisplayStyle.ComboBox : System.Windows.Forms.DataGridViewComboBoxDisplayStyle.DropDownButton;
			}
		}
		
				
		private Entities.TList<Entities.ArtiklKategorija> _IDArtiklKategorijaList;
		
		/// <summary> 
		/// The list of selectable ArtiklKategorija
		/// </summary>
		[System.ComponentModel.Category("DropDownList BindingSources")]
		public Entities.TList<Entities.ArtiklKategorija> IDArtiklKategorijaList
		{
			get {return this._IDArtiklKategorijaList;}
			set 
			{
				this._IDArtiklKategorijaList = value;
				this.uxIDArtiklKategorijaDataGridViewColumn.DataSource = null;
				this.uxIDArtiklKategorijaDataGridViewColumn.DataSource = this._IDArtiklKategorijaList;
			}
		}
		
		private bool _allowNewItemInIDArtiklKategorijaList;
		
		/// <summary> 
		/// Indicates if user can add an item in the list of ArtiklKategorija
		/// </summary>
		[System.ComponentModel.Category(".netTiers"), System.ComponentModel.Description("Indicates if end user can add a new item in the combobox. an event will be thrown then.")]
		public bool AllowNewItemInIDArtiklKategorijaList
		{
			get { return _allowNewItemInIDArtiklKategorijaList;}
			set
			{
				this._allowNewItemInIDArtiklKategorijaList = value;
				this.uxIDArtiklKategorijaDataGridViewColumn.DisplayStyle = value ? System.Windows.Forms.DataGridViewComboBoxDisplayStyle.ComboBox : System.Windows.Forms.DataGridViewComboBoxDisplayStyle.DropDownButton;
			}
		}
		
				
		private Entities.TList<Entities.ArtiklMjera> _IDJedinicnaMjeraList;
		
		/// <summary> 
		/// The list of selectable ArtiklMjera
		/// </summary>
		[System.ComponentModel.Category("DropDownList BindingSources")]
		public Entities.TList<Entities.ArtiklMjera> IDJedinicnaMjeraList
		{
			get {return this._IDJedinicnaMjeraList;}
			set 
			{
				this._IDJedinicnaMjeraList = value;
				this.uxIDJedinicnaMjeraDataGridViewColumn.DataSource = null;
				this.uxIDJedinicnaMjeraDataGridViewColumn.DataSource = this._IDJedinicnaMjeraList;
			}
		}
		
		private bool _allowNewItemInIDJedinicnaMjeraList;
		
		/// <summary> 
		/// Indicates if user can add an item in the list of ArtiklMjera
		/// </summary>
		[System.ComponentModel.Category(".netTiers"), System.ComponentModel.Description("Indicates if end user can add a new item in the combobox. an event will be thrown then.")]
		public bool AllowNewItemInIDJedinicnaMjeraList
		{
			get { return _allowNewItemInIDJedinicnaMjeraList;}
			set
			{
				this._allowNewItemInIDJedinicnaMjeraList = value;
				this.uxIDJedinicnaMjeraDataGridViewColumn.DisplayStyle = value ? System.Windows.Forms.DataGridViewComboBoxDisplayStyle.ComboBox : System.Windows.Forms.DataGridViewComboBoxDisplayStyle.DropDownButton;
			}
		}
		
				
		private Entities.TList<Entities.ArtiklStatus> _IDArtiklStatusList;
		
		/// <summary> 
		/// The list of selectable ArtiklStatus
		/// </summary>
		[System.ComponentModel.Category("DropDownList BindingSources")]
		public Entities.TList<Entities.ArtiklStatus> IDArtiklStatusList
		{
			get {return this._IDArtiklStatusList;}
			set 
			{
				this._IDArtiklStatusList = value;
				this.uxIDArtiklStatusDataGridViewColumn.DataSource = null;
				this.uxIDArtiklStatusDataGridViewColumn.DataSource = this._IDArtiklStatusList;
			}
		}
		
		private bool _allowNewItemInIDArtiklStatusList;
		
		/// <summary> 
		/// Indicates if user can add an item in the list of ArtiklStatus
		/// </summary>
		[System.ComponentModel.Category(".netTiers"), System.ComponentModel.Description("Indicates if end user can add a new item in the combobox. an event will be thrown then.")]
		public bool AllowNewItemInIDArtiklStatusList
		{
			get { return _allowNewItemInIDArtiklStatusList;}
			set
			{
				this._allowNewItemInIDArtiklStatusList = value;
				this.uxIDArtiklStatusDataGridViewColumn.DisplayStyle = value ? System.Windows.Forms.DataGridViewComboBoxDisplayStyle.ComboBox : System.Windows.Forms.DataGridViewComboBoxDisplayStyle.DropDownButton;
			}
		}
		
				
		private Entities.TList<Entities.Klijent> _IDProizvodacList;
		
		/// <summary> 
		/// The list of selectable Klijent
		/// </summary>
		[System.ComponentModel.Category("DropDownList BindingSources")]
		public Entities.TList<Entities.Klijent> IDProizvodacList
		{
			get {return this._IDProizvodacList;}
			set 
			{
				this._IDProizvodacList = value;
				this.uxIDProizvodacDataGridViewColumn.DataSource = null;
				this.uxIDProizvodacDataGridViewColumn.DataSource = this._IDProizvodacList;
			}
		}
		
		private bool _allowNewItemInIDProizvodacList;
		
		/// <summary> 
		/// Indicates if user can add an item in the list of Klijent
		/// </summary>
		[System.ComponentModel.Category(".netTiers"), System.ComponentModel.Description("Indicates if end user can add a new item in the combobox. an event will be thrown then.")]
		public bool AllowNewItemInIDProizvodacList
		{
			get { return _allowNewItemInIDProizvodacList;}
			set
			{
				this._allowNewItemInIDProizvodacList = value;
				this.uxIDProizvodacDataGridViewColumn.DisplayStyle = value ? System.Windows.Forms.DataGridViewComboBoxDisplayStyle.ComboBox : System.Windows.Forms.DataGridViewComboBoxDisplayStyle.DropDownButton;
			}
		}
		
				
		private Entities.TList<Entities.Porez> _IDPorezList;
		
		/// <summary> 
		/// The list of selectable Porez
		/// </summary>
		[System.ComponentModel.Category("DropDownList BindingSources")]
		public Entities.TList<Entities.Porez> IDPorezList
		{
			get {return this._IDPorezList;}
			set 
			{
				this._IDPorezList = value;
				this.uxIDPorezDataGridViewColumn.DataSource = null;
				this.uxIDPorezDataGridViewColumn.DataSource = this._IDPorezList;
			}
		}
		
		private bool _allowNewItemInIDPorezList;
		
		/// <summary> 
		/// Indicates if user can add an item in the list of Porez
		/// </summary>
		[System.ComponentModel.Category(".netTiers"), System.ComponentModel.Description("Indicates if end user can add a new item in the combobox. an event will be thrown then.")]
		public bool AllowNewItemInIDPorezList
		{
			get { return _allowNewItemInIDPorezList;}
			set
			{
				this._allowNewItemInIDPorezList = value;
				this.uxIDPorezDataGridViewColumn.DisplayStyle = value ? System.Windows.Forms.DataGridViewComboBoxDisplayStyle.ComboBox : System.Windows.Forms.DataGridViewComboBoxDisplayStyle.DropDownButton;
			}
		}
		
		#endregion
		
		#region Main Datasource
		
		private Entities.TList<Entities.Artikl> _ArtiklList;
				
		/// <summary> 
		/// The list of Artikl to be displayed in the DGV.
		/// </summary>
		[System.ComponentModel.Category("Data")]
		public Entities.TList<Entities.Artikl> ArtiklList
		{
			get {return this._ArtiklList;}
			set
			{
				this._ArtiklList = value;
				this.uxArtiklBindingSource.DataSource = null;
				this.uxArtiklBindingSource.DataSource = value;
				this.uxArtiklDataGridView.DataSource = null;
				this.uxArtiklDataGridView.DataSource = this.uxArtiklBindingSource;				
				//this.uxArtiklBindingSource.ListChanged += new System.ComponentModel.ListChangedEventHandler(uxArtiklBindingSource_ListChanged);
				this.uxArtiklBindingSource.CurrentItemChanged += new System.EventHandler(OnArtiklBindingSourceCurrentItemChanged);
			}
		}
		
		private void OnArtiklBindingSourceCurrentItemChanged(object sender, System.EventArgs e)
		{
			_currentArtikl = uxArtiklBindingSource.Current as Entities.Artikl;
			
			if (_currentArtikl != null)
			{
				_currentArtikl.Validate();
			}
			//_Artikl.Validate();
			OnCurrentEntityChanged();
		}

		//void uxArtiklBindingSource_ListChanged(object sender, System.ComponentModel.ListChangedEventArgs e)
		//{
			//throw new Exception("The method or operation is not implemented.");
		//}		
		
		#endregion
		
		/// <summary>
		/// Gets the currently selected <c cref="Entities.Artikl"/> instance.
		/// </summary>
		public Entities.Artikl SelectedArtikl
		{
			get {return this._currentArtikl;}
		}
		
		#region other properties
		
		/// <summary>
		/// Gets or sets a value indicating whether you have provided your own data-management operations for the DataGridView control.
		/// </summary>
		[System.ComponentModel.Category(".netTiers")]
		public bool VirtualMode
		{
			get {return this.uxArtiklDataGridView.VirtualMode;}
			set
			{
				this.uxArtiklDataGridView.VirtualMode = value;
			}
		}
		
		/// <summary>
		/// Gets or sets a value indicating whether the option to add rows is displayed to the user.
		/// </summary>
		[System.ComponentModel.Category(".netTiers")]
		public bool AllowUserToAddRows
		{
			get {return this.uxArtiklDataGridView.AllowUserToAddRows;}
			set {this.uxArtiklDataGridView.AllowUserToAddRows = value;}
		}
		
		/// <summary>
		/// Gets or sets a value indicating whether the user is allowed to delete rows from the DataGridView.
		/// </summary>
		[System.ComponentModel.Category(".netTiers")]
		public bool AllowUserToDeleteRows
		{
			get {return this.uxArtiklDataGridView.AllowUserToDeleteRows;}
			set {this.uxArtiklDataGridView.AllowUserToDeleteRows = value;}
		}
		
		/// <summary>
		/// Gets the <c cref="DataGridView"/> instance.
		/// </summary>
		[System.ComponentModel.Category(".netTiers")]
		public System.Windows.Forms.DataGridView DataGridView
		{
			get {return this.uxArtiklDataGridView;}
		}
		
		/// <summary>
		/// Gets a collection that contains all the columns in the control.
		/// </summary>
		[System.ComponentModel.Category(".netTiers")]		
		[System.ComponentModel.DesignerSerializationVisibilityAttribute(System.ComponentModel.DesignerSerializationVisibility.Visible)]
		//[System.ComponentModel.EditorAttribute("System.Windows.Forms.Design.DataGridViewColumnCollectionEditor, System.Design", typeof(System.Drawing.Design.UITypeEditor))] 
		public System.Windows.Forms.DataGridViewColumnCollection Columns
		{
			get { return this.uxArtiklDataGridView.Columns; }
		}
		
		#endregion
		
		/// <summary> 
		/// Required designer variable.
		/// </summary>
		private System.ComponentModel.IContainer components = null;
	
		/// <summary> 
		/// Clean up any resources being used.
		/// </summary>
		/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
		protected override void Dispose(bool disposing)
		{
			if (disposing && (components != null))
			{
				components.Dispose();
			}
			base.Dispose(disposing);
		}
	
		#region Constructor
	
		/// <summary>
		/// Initializes a new instance of the <see cref="ArtiklDataGridViewBase"/> class.
		/// </summary>
		public ArtiklDataGridViewBase()
		{			
			this.components = new System.ComponentModel.Container();			
			
			this.uxArtiklDataGridView = new System.Windows.Forms.DataGridView();
			this.uxArtiklBindingSource = new System.Windows.Forms.BindingSource(this.components);
			this.uxArtiklErrorProvider = new System.Windows.Forms.ErrorProvider(this.components);
			this.uxIDDataGridViewColumn = new System.Windows.Forms.DataGridViewComboBoxColumn();
			this.uxNazivDataGridViewColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
			this.uxBarCodeDataGridViewColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
			this.uxKataloskibrojDataGridViewColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
			this.uxOptimalnaKolDataGridViewColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
			this.uxSlikaDataGridViewColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
			this.uxIDProizvodacDataGridViewColumn = new System.Windows.Forms.DataGridViewComboBoxColumn();
			this.uxIDJedinicnaMjeraDataGridViewColumn = new System.Windows.Forms.DataGridViewComboBoxColumn();
			this.uxIDArtiklKategorijaDataGridViewColumn = new System.Windows.Forms.DataGridViewComboBoxColumn();
			this.uxIDPorezDataGridViewColumn = new System.Windows.Forms.DataGridViewComboBoxColumn();
			this.uxUslugaDataGridViewColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
			this.uxCijenaUslugeDataGridViewColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
			this.uxIDArtiklStatusDataGridViewColumn = new System.Windows.Forms.DataGridViewComboBoxColumn();
			//this.uxIDBindingSource = new ArtiklBindingSource(this.components);
			//((System.ComponentModel.ISupportInitialize)(this.uxIDBindingSource)).BeginInit();
			//this.uxIDArtiklKategorijaBindingSource = new ArtiklKategorijaBindingSource(this.components);
			//((System.ComponentModel.ISupportInitialize)(this.uxIDArtiklKategorijaBindingSource)).BeginInit();
			//this.uxIDJedinicnaMjeraBindingSource = new ArtiklMjeraBindingSource(this.components);
			//((System.ComponentModel.ISupportInitialize)(this.uxIDJedinicnaMjeraBindingSource)).BeginInit();
			//this.uxIDArtiklStatusBindingSource = new ArtiklStatusBindingSource(this.components);
			//((System.ComponentModel.ISupportInitialize)(this.uxIDArtiklStatusBindingSource)).BeginInit();
			//this.uxIDProizvodacBindingSource = new KlijentBindingSource(this.components);
			//((System.ComponentModel.ISupportInitialize)(this.uxIDProizvodacBindingSource)).BeginInit();
			//this.uxIDPorezBindingSource = new PorezBindingSource(this.components);
			//((System.ComponentModel.ISupportInitialize)(this.uxIDPorezBindingSource)).BeginInit();
			((System.ComponentModel.ISupportInitialize)(this.uxArtiklDataGridView)).BeginInit();
			((System.ComponentModel.ISupportInitialize)(this.uxArtiklBindingSource)).BeginInit();
			((System.ComponentModel.ISupportInitialize)(this.uxArtiklErrorProvider)).BeginInit();
			this.SuspendLayout();
						
			// 
			// uxArtiklErrorProvider
			// 
			this.uxArtiklErrorProvider.ContainerControl = this;
			this.uxArtiklErrorProvider.DataSource = this.uxArtiklBindingSource;						
			// 
			// uxArtiklDataGridView
			// 
			this.uxArtiklDataGridView.AutoGenerateColumns = false;
			this.uxArtiklDataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
			this.uxArtiklDataGridView.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
		this.uxIDDataGridViewColumn,
		this.uxNazivDataGridViewColumn,
		this.uxBarCodeDataGridViewColumn,
		this.uxKataloskibrojDataGridViewColumn,
		this.uxOptimalnaKolDataGridViewColumn,
		this.uxSlikaDataGridViewColumn,
		this.uxIDProizvodacDataGridViewColumn,
		this.uxIDJedinicnaMjeraDataGridViewColumn,
		this.uxIDArtiklKategorijaDataGridViewColumn,
		this.uxIDPorezDataGridViewColumn,
		this.uxUslugaDataGridViewColumn,
		this.uxCijenaUslugeDataGridViewColumn,
		this.uxIDArtiklStatusDataGridViewColumn			});
			this.uxArtiklDataGridView.Dock = System.Windows.Forms.DockStyle.Fill;
			this.uxArtiklDataGridView.Location = new System.Drawing.Point(0, 0);
			this.uxArtiklDataGridView.Name = "uxArtiklDataGridView";
			this.uxArtiklDataGridView.Size = new System.Drawing.Size(470, 300);
			this.uxArtiklDataGridView.TabIndex = 0;	
			this.uxArtiklDataGridView.BackgroundColor = System.Drawing.Color.WhiteSmoke;
			this.uxArtiklDataGridView.EnableHeadersVisualStyles = false;
			this.uxArtiklDataGridView.DataError += new System.Windows.Forms.DataGridViewDataErrorEventHandler(this.OnArtiklDataGridViewDataError);
			this.uxArtiklDataGridView.CellValueNeeded += new System.Windows.Forms.DataGridViewCellValueEventHandler(this.OnArtiklDataGridViewCellValueNeeded);
			this.uxArtiklDataGridView.CellValuePushed += new System.Windows.Forms.DataGridViewCellValueEventHandler(this.OnArtiklDataGridViewCellValuePushed);
			
			//
			// uxIDDataGridViewColumn
			//
			this.uxIDDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxIDDataGridViewColumn.DataPropertyName = "ID";
			this.uxIDDataGridViewColumn.HeaderText = "ID";
			this.uxIDDataGridViewColumn.Name = "uxIDDataGridViewColumn";
			this.uxIDDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxIDDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxIDDataGridViewColumn.ReadOnly = true;		
			//
			// uxNazivDataGridViewColumn
			//
			this.uxNazivDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxNazivDataGridViewColumn.DataPropertyName = "Naziv";
			this.uxNazivDataGridViewColumn.HeaderText = "Naziv";
			this.uxNazivDataGridViewColumn.Name = "uxNazivDataGridViewColumn";
			this.uxNazivDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxNazivDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxNazivDataGridViewColumn.ReadOnly = false;		
			//
			// uxBarCodeDataGridViewColumn
			//
			this.uxBarCodeDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxBarCodeDataGridViewColumn.DataPropertyName = "BarCode";
			this.uxBarCodeDataGridViewColumn.HeaderText = "BarCode";
			this.uxBarCodeDataGridViewColumn.Name = "uxBarCodeDataGridViewColumn";
			this.uxBarCodeDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxBarCodeDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxBarCodeDataGridViewColumn.ReadOnly = false;		
			//
			// uxKataloskibrojDataGridViewColumn
			//
			this.uxKataloskibrojDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxKataloskibrojDataGridViewColumn.DataPropertyName = "Kataloskibroj";
			this.uxKataloskibrojDataGridViewColumn.HeaderText = "Kataloskibroj";
			this.uxKataloskibrojDataGridViewColumn.Name = "uxKataloskibrojDataGridViewColumn";
			this.uxKataloskibrojDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxKataloskibrojDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxKataloskibrojDataGridViewColumn.ReadOnly = false;		
			//
			// uxOptimalnaKolDataGridViewColumn
			//
			this.uxOptimalnaKolDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxOptimalnaKolDataGridViewColumn.DataPropertyName = "OptimalnaKol";
			this.uxOptimalnaKolDataGridViewColumn.HeaderText = "OptimalnaKol";
			this.uxOptimalnaKolDataGridViewColumn.Name = "uxOptimalnaKolDataGridViewColumn";
			this.uxOptimalnaKolDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxOptimalnaKolDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxOptimalnaKolDataGridViewColumn.ReadOnly = false;		
			//
			// uxSlikaDataGridViewColumn
			//
			this.uxSlikaDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxSlikaDataGridViewColumn.DataPropertyName = "Slika";
			this.uxSlikaDataGridViewColumn.HeaderText = "Slika";
			this.uxSlikaDataGridViewColumn.Name = "uxSlikaDataGridViewColumn";
			this.uxSlikaDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxSlikaDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxSlikaDataGridViewColumn.ReadOnly = false;		
			//
			// uxIDProizvodacDataGridViewColumn
			//
			this.uxIDProizvodacDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxIDProizvodacDataGridViewColumn.DataPropertyName = "IDProizvodac";
			this.uxIDProizvodacDataGridViewColumn.HeaderText = "IDProizvodac";
			this.uxIDProizvodacDataGridViewColumn.Name = "uxIDProizvodacDataGridViewColumn";
			this.uxIDProizvodacDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxIDProizvodacDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxIDProizvodacDataGridViewColumn.ReadOnly = false;		
			//
			// uxIDJedinicnaMjeraDataGridViewColumn
			//
			this.uxIDJedinicnaMjeraDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxIDJedinicnaMjeraDataGridViewColumn.DataPropertyName = "IDJedinicnaMjera";
			this.uxIDJedinicnaMjeraDataGridViewColumn.HeaderText = "IDJedinicnaMjera";
			this.uxIDJedinicnaMjeraDataGridViewColumn.Name = "uxIDJedinicnaMjeraDataGridViewColumn";
			this.uxIDJedinicnaMjeraDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxIDJedinicnaMjeraDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxIDJedinicnaMjeraDataGridViewColumn.ReadOnly = false;		
			//
			// uxIDArtiklKategorijaDataGridViewColumn
			//
			this.uxIDArtiklKategorijaDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxIDArtiklKategorijaDataGridViewColumn.DataPropertyName = "IDArtiklKategorija";
			this.uxIDArtiklKategorijaDataGridViewColumn.HeaderText = "IDArtiklKategorija";
			this.uxIDArtiklKategorijaDataGridViewColumn.Name = "uxIDArtiklKategorijaDataGridViewColumn";
			this.uxIDArtiklKategorijaDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxIDArtiklKategorijaDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxIDArtiklKategorijaDataGridViewColumn.ReadOnly = false;		
			//
			// uxIDPorezDataGridViewColumn
			//
			this.uxIDPorezDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxIDPorezDataGridViewColumn.DataPropertyName = "IDPorez";
			this.uxIDPorezDataGridViewColumn.HeaderText = "IDPorez";
			this.uxIDPorezDataGridViewColumn.Name = "uxIDPorezDataGridViewColumn";
			this.uxIDPorezDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxIDPorezDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxIDPorezDataGridViewColumn.ReadOnly = false;		
			//
			// uxUslugaDataGridViewColumn
			//
			this.uxUslugaDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxUslugaDataGridViewColumn.DataPropertyName = "Usluga";
			this.uxUslugaDataGridViewColumn.HeaderText = "Usluga";
			this.uxUslugaDataGridViewColumn.Name = "uxUslugaDataGridViewColumn";
			this.uxUslugaDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxUslugaDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxUslugaDataGridViewColumn.ReadOnly = false;		
			//
			// uxCijenaUslugeDataGridViewColumn
			//
			this.uxCijenaUslugeDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxCijenaUslugeDataGridViewColumn.DataPropertyName = "CijenaUsluge";
			this.uxCijenaUslugeDataGridViewColumn.HeaderText = "CijenaUsluge";
			this.uxCijenaUslugeDataGridViewColumn.Name = "uxCijenaUslugeDataGridViewColumn";
			this.uxCijenaUslugeDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxCijenaUslugeDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxCijenaUslugeDataGridViewColumn.ReadOnly = false;		
			//
			// uxIDArtiklStatusDataGridViewColumn
			//
			this.uxIDArtiklStatusDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxIDArtiklStatusDataGridViewColumn.DataPropertyName = "IDArtiklStatus";
			this.uxIDArtiklStatusDataGridViewColumn.HeaderText = "IDArtiklStatus";
			this.uxIDArtiklStatusDataGridViewColumn.Name = "uxIDArtiklStatusDataGridViewColumn";
			this.uxIDArtiklStatusDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxIDArtiklStatusDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxIDArtiklStatusDataGridViewColumn.ReadOnly = false;		
			//
			// uxIDDataGridViewColumn
			//				
			this.uxIDDataGridViewColumn.DisplayMember = "Naziv";	
			this.uxIDDataGridViewColumn.ValueMember = "ID";	
			this.uxIDDataGridViewColumn.DisplayStyleForCurrentCellOnly = true;
			//uxIDDataGridViewColumn.DataSource = uxIDBindingSource;				
				
			//
			// uxIDArtiklKategorijaDataGridViewColumn
			//				
			this.uxIDArtiklKategorijaDataGridViewColumn.DisplayMember = "Naziv";	
			this.uxIDArtiklKategorijaDataGridViewColumn.ValueMember = "ID";	
			this.uxIDArtiklKategorijaDataGridViewColumn.DisplayStyleForCurrentCellOnly = true;
			//uxIDArtiklKategorijaDataGridViewColumn.DataSource = uxIDArtiklKategorijaBindingSource;				
				
			//
			// uxIDJedinicnaMjeraDataGridViewColumn
			//				
			this.uxIDJedinicnaMjeraDataGridViewColumn.DisplayMember = "Naziv";	
			this.uxIDJedinicnaMjeraDataGridViewColumn.ValueMember = "ID";	
			this.uxIDJedinicnaMjeraDataGridViewColumn.DisplayStyleForCurrentCellOnly = true;
			//uxIDJedinicnaMjeraDataGridViewColumn.DataSource = uxIDJedinicnaMjeraBindingSource;				
				
			//
			// uxIDArtiklStatusDataGridViewColumn
			//				
			this.uxIDArtiklStatusDataGridViewColumn.DisplayMember = "Naziv";	
			this.uxIDArtiklStatusDataGridViewColumn.ValueMember = "ID";	
			this.uxIDArtiklStatusDataGridViewColumn.DisplayStyleForCurrentCellOnly = true;
			//uxIDArtiklStatusDataGridViewColumn.DataSource = uxIDArtiklStatusBindingSource;				
				
			//
			// uxIDProizvodacDataGridViewColumn
			//				
			this.uxIDProizvodacDataGridViewColumn.DisplayMember = "ImeKlijenta";	
			this.uxIDProizvodacDataGridViewColumn.ValueMember = "ID";	
			this.uxIDProizvodacDataGridViewColumn.DisplayStyleForCurrentCellOnly = true;
			//uxIDProizvodacDataGridViewColumn.DataSource = uxIDProizvodacBindingSource;				
				
			//
			// uxIDPorezDataGridViewColumn
			//				
			this.uxIDPorezDataGridViewColumn.DisplayMember = "Naziv";	
			this.uxIDPorezDataGridViewColumn.ValueMember = "ID";	
			this.uxIDPorezDataGridViewColumn.DisplayStyleForCurrentCellOnly = true;
			//uxIDPorezDataGridViewColumn.DataSource = uxIDPorezBindingSource;				
				
			
			// this
			this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
			this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
			this.Controls.Add(this.uxArtiklDataGridView);
			this.Name = "ArtiklDataGridView";
			this.Size = new System.Drawing.Size(470, 300);
			//((System.ComponentModel.ISupportInitialize)(this.uxIDBindingSource)).EndInit();
			//((System.ComponentModel.ISupportInitialize)(this.uxIDArtiklKategorijaBindingSource)).EndInit();
			//((System.ComponentModel.ISupportInitialize)(this.uxIDJedinicnaMjeraBindingSource)).EndInit();
			//((System.ComponentModel.ISupportInitialize)(this.uxIDArtiklStatusBindingSource)).EndInit();
			//((System.ComponentModel.ISupportInitialize)(this.uxIDProizvodacBindingSource)).EndInit();
			//((System.ComponentModel.ISupportInitialize)(this.uxIDPorezBindingSource)).EndInit();
			((System.ComponentModel.ISupportInitialize)(this.uxArtiklErrorProvider)).EndInit();
			((System.ComponentModel.ISupportInitialize)(this.uxArtiklDataGridView)).EndInit();
			((System.ComponentModel.ISupportInitialize)(this.uxArtiklBindingSource)).EndInit();
			this.ResumeLayout(false);
		}
		#endregion
				
		#region events
		
		/// <summary>
		/// Raised the CurrentEntityChanged event.
		/// </summary>
		protected void OnCurrentEntityChanged()
		{
			if (CurrentEntityChanged != null)
			{
				ArtiklDataGridViewEventArgs args = new ArtiklDataGridViewEventArgs();
				args.Artikl = _currentArtikl;
				CurrentEntityChanged(this, args); 
			}
		}
		
		#endregion
		
		/// <summary>
		/// Strongly typed event 
		/// </summary>
		public class ArtiklDataGridViewEventArgs : System.EventArgs
		{
			private Entities.Artikl	_Artikl;
	
			/// <summary>
			/// the  Entities.Artikl instance.
			/// </summary>
			public Entities.Artikl Artikl
			{
				get { return _Artikl; }
				set { _Artikl = value; }
			}	
		}
		
		/// <summary>
		/// Handles the DataError event of the uxArtiklDataGridView control.
		/// </summary>
		/// <param name="sender">The source of the event.</param>
		/// <param name="e">The <see cref="T:System.Windows.Forms.DataGridViewDataErrorEventArgs"/> instance containing the event data.</param>
		protected void OnArtiklDataGridViewDataError(object sender, System.Windows.Forms.DataGridViewDataErrorEventArgs e)
		{
			System.Diagnostics.Debug.WriteLine(string.Format( "{0}, {1}", e.ColumnIndex, e.RowIndex));
		}
		
		/// <summary>
		/// Handles the CellValueNeeded event of the uxArtiklDataGridView control.
		/// </summary>
		/// <param name="sender">The source of the event.</param>
		/// <param name="e">The <see cref="T:System.Windows.Forms.DataGridViewCellValueEventArgs"/> instance containing the event data.</param>
		protected void OnArtiklDataGridViewCellValueNeeded(object sender, System.Windows.Forms.DataGridViewCellValueEventArgs e)
		{
			switch(uxArtiklDataGridView.Columns[e.ColumnIndex].Name)
			{
					case "uxIDDataGridViewColumn":
						e.Value = ArtiklList[e.RowIndex].ID;
						break;
					case "uxNazivDataGridViewColumn":
						e.Value = ArtiklList[e.RowIndex].Naziv;
						break;
					case "uxBarCodeDataGridViewColumn":
						e.Value = ArtiklList[e.RowIndex].BarCode;
						break;
					case "uxKataloskibrojDataGridViewColumn":
						e.Value = ArtiklList[e.RowIndex].Kataloskibroj;
						break;
					case "uxOptimalnaKolDataGridViewColumn":
						e.Value = ArtiklList[e.RowIndex].OptimalnaKol;
						break;
					case "uxSlikaDataGridViewColumn":
						e.Value = ArtiklList[e.RowIndex].Slika;
						break;
					case "uxIDProizvodacDataGridViewColumn":
						e.Value = ArtiklList[e.RowIndex].IDProizvodac;
						break;
					case "uxIDJedinicnaMjeraDataGridViewColumn":
						e.Value = ArtiklList[e.RowIndex].IDJedinicnaMjera;
						break;
					case "uxIDArtiklKategorijaDataGridViewColumn":
						e.Value = ArtiklList[e.RowIndex].IDArtiklKategorija;
						break;
					case "uxIDPorezDataGridViewColumn":
						e.Value = ArtiklList[e.RowIndex].IDPorez;
						break;
					case "uxUslugaDataGridViewColumn":
						e.Value = ArtiklList[e.RowIndex].Usluga;
						break;
					case "uxCijenaUslugeDataGridViewColumn":
						e.Value = ArtiklList[e.RowIndex].CijenaUsluge;
						break;
					case "uxIDArtiklStatusDataGridViewColumn":
						e.Value = ArtiklList[e.RowIndex].IDArtiklStatus;
						break;
				default:
				break;
			}
		}
		
		/// <summary>
		/// Handles the CellValuePushed event of the uxArtiklDataGridView control.
		/// </summary>
		/// <param name="sender">The source of the event.</param>
		/// <param name="e">The <see cref="T:System.Windows.Forms.DataGridViewCellValueEventArgs"/> instance containing the event data.</param>
		protected void OnArtiklDataGridViewCellValuePushed(object sender, System.Windows.Forms.DataGridViewCellValueEventArgs e)
		{
			switch(uxArtiklDataGridView.Columns[e.ColumnIndex].Name)
			{
					case "uxIDDataGridViewColumn":
						ArtiklList[e.RowIndex].ID = (System.Int32)e.Value;
						break;
					case "uxNazivDataGridViewColumn":
						ArtiklList[e.RowIndex].Naziv = (System.String)e.Value;
						break;
					case "uxBarCodeDataGridViewColumn":
						ArtiklList[e.RowIndex].BarCode = (System.String)e.Value;
						break;
					case "uxKataloskibrojDataGridViewColumn":
						ArtiklList[e.RowIndex].Kataloskibroj = (System.String)e.Value;
						break;
					case "uxOptimalnaKolDataGridViewColumn":
						ArtiklList[e.RowIndex].OptimalnaKol = (System.Single?)e.Value;
						break;
					case "uxSlikaDataGridViewColumn":
						ArtiklList[e.RowIndex].Slika = (System.Byte[])e.Value;
						break;
					case "uxIDProizvodacDataGridViewColumn":
						ArtiklList[e.RowIndex].IDProizvodac = (System.Int32?)e.Value;
						break;
					case "uxIDJedinicnaMjeraDataGridViewColumn":
						ArtiklList[e.RowIndex].IDJedinicnaMjera = (System.Int32)e.Value;
						break;
					case "uxIDArtiklKategorijaDataGridViewColumn":
						ArtiklList[e.RowIndex].IDArtiklKategorija = (System.Int32)e.Value;
						break;
					case "uxIDPorezDataGridViewColumn":
						ArtiklList[e.RowIndex].IDPorez = (System.Int32)e.Value;
						break;
					case "uxUslugaDataGridViewColumn":
						ArtiklList[e.RowIndex].Usluga = (System.Int32)e.Value;
						break;
					case "uxCijenaUslugeDataGridViewColumn":
						ArtiklList[e.RowIndex].CijenaUsluge = (System.Decimal?)e.Value;
						break;
					case "uxIDArtiklStatusDataGridViewColumn":
						ArtiklList[e.RowIndex].IDArtiklStatus = (System.Int32)e.Value;
						break;
				default:
				break;
			}
		}
	}
}
